Skip to main content

Quick Start Guide for Suger Go SDK

Follow these steps to get started with the Suger Go SDK:

1. Install the SDK

To include the Suger SDK in your project, you can clone new release version of the SDK in your terminal:

git clone https://github.com/sugerio/suger-sdk-go.git

Put the package under your project folder and add the following in import:

import suger "github.com/sugerio/suger-sdk-go"

Step 2: Set up your configuration and Create ApiClient

Once you have added the package, you can create a configuration. Here’s how to do it:

import (
"github.com/sugerio/suger-sdk-go"
)
configuration := suger.NewConfiguration()
configuration.Servers = suger.ServerConfigurations{
{
URL: "https://api.suger.cloud",
Description: "No description provided",
},
}
apiClient := suger.NewAPIClient(configuration)

Step 3: Use the Client

Now that you have your client set up, you can call Suger services. Here’s a simple example of how to make a service call:

auth := context.WithValue(
context.Background(),
suger.ContextAPIKeys,
map[string]suger.APIKey{
"APIKeyAuth": {Key: "Key " + "your api kei"},
},
)
var orgId = "your_org_id"
var offerId = "your_offer_id"
execute, response, err := apiClient.OfferAPI.GetOffer(auth, orgId, offerId).Execute()

Conclusion

You are now ready to use the Suger Go SDK in your application! For more detailed information and advanced usage, please refer to the official documentation.